/**
 * webpack4中import不支持变量
 * const resolve = name => () => import(`@/pages/${name}`)
 */
const resolve = (name) => (resolve) => require([`@/pages/${name}.vue`], resolve);

import Home from '@/Home'

const appRouter = [
  {
    path: "/",
    name: "Home",
    redirect: '/home',
    component: Home,
    children: [
      {
        path: "/home",
        name: "HomeIndex",
        meta: {
          title: "Inicio"
        },
        component: resolve("home/index"),
      },
      {
        path: "/order",
        name: "OrderIndex",
        meta: {
          title: "Mis pedidos"
        },
        component: resolve("order/index"),
      },
      {
        path: "/help",
        name: "HelpIndex",
        meta: {
          title: "Soporte"
        },
        component: resolve("help/index"),
      }
    ],
  },
  {
    path: "/login",
    name: "Login",
    meta: {
      title: "登录",
    },
    component: resolve("login/index"),
  },
  {
    path: "/kyc",
    name: "Kyc",
    meta: {
      title: "kyc",
    },
    component: resolve("kyc/index"),
  },
  {
    path: "/privacy/user",
    name: "PrivacyUser",
    meta: {
      title: "Política de Privacidad",
    },
    component: resolve("privacy/user"),
  },
];
// 🏷️ 基础路由
const otherRouter = [
  {
    path: "/404",
    name: "NotFound",
    meta: {
      title: "Not found",
    },
    component: resolve("public/404"),
  },
  {
    path: "/*",
    name: "Undefined",
    redirect: "/404",
  },
];

export default [...appRouter, ...otherRouter];
